home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / program / tpwpxeng.zip / PUTSHORT.PAS < prev    next >
Pascal/Delphi Source File  |  1991-07-22  |  795b  |  35 lines

  1. program PutShort;
  2. uses PXEngine, WinCrt;
  3.  
  4. const TableName = 'Table';
  5.  
  6. var   PxErr: Integer;
  7.       TblHandle: TableHandle;
  8.       RecHandle: RecordHandle;
  9.       FldHandle: FieldHandle;
  10.       SValue: Integer;
  11.  
  12. procedure PX(Code : integer);
  13. begin
  14.   writeln(PXErrMsg(Code));
  15. end;
  16.  
  17. begin
  18.   PX(PXWinInit('MyApp', pxShared));
  19.   SValue := 321;
  20.  
  21.   PX(PXTblOpen(TableName, TblHandle, 0, False));
  22.   PX(PXRecBufOpen(TblHandle, RecHandle));
  23.   PX(PXFldHandle(TblHandle, 'Short Field', FldHandle));
  24.  
  25.   (* Update record with short value *)
  26.   PxErr := PXPutShort(RecHandle, FldHandle, SValue);
  27.   if PxErr <> PxSuccess then
  28.     Writeln(PxErrMsg(PxErr))
  29.   else PX(PXRecUpdate(TblHandle,RecHandle));
  30.  
  31.   PX(PXRecBufClose(RecHandle));
  32.   PX(PXTblClose(TblHandle));
  33.   PX(PXExit);
  34. end.
  35.